<?php

namespace App\Http\Controllers\Admin;

use App\Common\Comiter;
use App\Http\Controllers\Controller;
use App\Models\Shop;
use Illuminate\Http\Request;

class ShopController extends Controller
{
    //
    public function ShopList(Request $request){
        if ($request->method() != 'GET') throw  new  \Exception('请求方式不正确');
        $num=$request->input('num');
        $data=Shop::paginate($num)->withQueryString();
        if($data){
        return view('admin.shopList',compact('data'));
        }else{
            return Comiter::fail('403','展示失败',null);
        }
    }
    public function change(Request $request)
    {
        $id = $request->get('id');
        $fangStatus= $request->get('fang_status');
        Shop::where('id','=',$id)->update(['fang_status'=>$fangStatus]);

        return ['errorCode'=>0,'msg'=>'修改成功','data'=>''];
    }
}
